package magic;

import java.util.Scanner;

import player.Player;
import card.MagicCard;

/**
To display magic card function
*/
public class MagicWindow {
	private Player player;
	
	public MagicWindow(Player player){
		this.player = player;
	}
	
	public void greet() {
		
		System.out.println("Welcome to Magic Cell, You can choose the Magic Card randomly");
		System.out.println("Press Enter to pick a Magic Card");
		Scanner keyboard = new Scanner(System.in);
		keyboard.nextLine();
		
		MagicController magicController = new MagicController(player);
		int diceNo = magicController.RandomCards();
		System.out.println(showResult(diceNo));
	}
	
	/**
	To show the magic card result generated by the game
	 */
	public String showResult(int diceNo){
		MagicController magicController = new MagicController(player);
		int isPicked = 	magicController.pickMagicCard(diceNo);
		
		MagicCard card = new MagicCard();
		if(isPicked != 0){
			return "Congratulation, you get a "+ card.getDetail(isPicked);	
		}
		else
			return "Sorry, You do not get any Magic Card this time";
	}
}